package com.aly.beanValidate.core.enums;

public enum CAL {
    /**
     * 等于
     */
    EQ((left, right) -> left == right),
    /**
     * 不等于
     */
    NEQ((left, right) -> left != right),
    /**
     * 大于
     */
    GT((left, right) -> left > right),
    /**
     * 小于
     */
    LT((left, right) -> left < right),
    /**
     * 大于等于
     */
    EGT((left, right) -> left >= right),
    /**
     * 小于等于
     */
    ELT((left, right) -> left <= right);
    private IntPredicate test;

    CAL(IntPredicate test) {
        this.test = test;
    }

    public boolean test(int left, int right) {
        return this.test.test(left, right);
    }

    @FunctionalInterface
    private interface IntPredicate {
        boolean test(int left, int right);
    }
}